{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Path Overview\n",
    "`Path` contains `Lines` and `Curves` which can be stroked or filled. `Contour` is composed of a series of connected `Lines` and `Curves`. `Path` may contain zero, one, or more `Contours`. Each `Line` and `Curve` are described by `Verb`, `Points`, and optional `Path_Conic_Weight`.\n",
    "\n",
    "Each pair of connected `Lines` and `Curves` share common `Point`; for instance, `Path` containing two connected `Lines` are described the `Path_Verb` sequence: `Path.kMove`, `Path.kLine`, `Path.kLine`; and a `Point` sequence with three entries, sharing the middle entry as the end of the first Line and the start of the second Line.\n",
    "\n",
    "`Path` components `Arc`, `Rect`, `Round_Rect`, `Circle`, and `Oval` are composed of `Lines` and `Curves` with as many `Verbs` and `Points` required for an exact description. Once added to `Path`, these components may lose their identity; although `Path` can be inspected to determine if it describes a single `Rect`, `Oval`, `Round_Rect`, and so on.\n",
    "\n",
    "### Example"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import skia\n",
    "from IPython.display import display, Image\n",
    "\n",
    "def show(draw):\n",
    "    surface = skia.Surface(256, 192)\n",
    "    draw(surface.getCanvas())\n",
    "    image = surface.makeImageSnapshot()\n",
    "    display(Image(data=image.encodeToData()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "def draw(canvas: skia.Canvas):\n",
    "    paint = skia.Paint()\n",
    "    paint.setAntiAlias(True)\n",
    "    path = skia.Path()\n",
    "    path.moveTo(124, 108)\n",
    "    path.lineTo(172, 24)\n",
    "    path.addCircle(50, 50, 30)\n",
    "    path.moveTo(36, 148)\n",
    "    path.quadTo(66, 188, 120, 136)\n",
    "    canvas.drawPath(path, paint)\n",
    "    paint.setStyle(skia.Paint.kStroke_Style);\n",
    "    paint.setColor(skia.ColorBLUE)\n",
    "    paint.setStrokeWidth(3)\n",
    "    canvas.drawPath(path, paint)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`Path` contains three Contours: `Line`, `Circle`, and `Quad`. `Line` is stroked but not filled. `Circle` is stroked and filled; `Circle` stroke forms a loop. `Quad` is stroked and filled, but since it is not closed, `Quad` does not stroke a loop."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQAAAADACAYAAADr7b1mAAAABHNCSVQICAgIfAhkiAAACXpJREFUeJzt3Tty48oVxvGPLucX5QX4IrCd3So6cTrYgZg7GDh1InkFw5s5k2YF1F3ByCsY3hWI4w2IE9mBq8hZwXEAcNAACYkPkN3s/v+qukSh+GiCOP06BCgBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/Rr4rcDx7V9/IJI3r2wtJ6+rm6NfL1wnAGdiNZPeSvUhmB5aX+rE3vt8FgL1YJtl7yT5Jtjoi6PvKqn7O99VrAGkLcApgt5Kmqob2r9iM8NeqRv5SNRPYPOzd1iM61tXrjD4eXkcAA7P3/UP8pUkPJhUm6cAyqR+7fG2K8N7PewaSZ4Vkz7uD/s6k/Iig7yt5/Zw7G4Pnqi4Ik5V8PtGxcjsQ13WQDhX0feWufq2thqC81LvHvixz1oI+s34TBZttB/7UpOwCwb8pWf2aWw3B7FJ7AfuwB+ezWfquDU5iWd2KOwG3uHDg72oIFt1GgJ4mCJZ3PpfCd41wNBtra77/6DHwu+Wx2wg8V3WGP63OYu67NjiaZdvBf4m5/qHlblcjwEjACys6n0Xuu0Y4mtuSr61Kz/kO9r4ysc66wOdz7hn0aaWFH3zXBkfrLviFHPxuI8DCoD925+z7NaOwq9VN9YU47N97OlCeZx+hrZX2s6oxwBXqzuEeAwjqQ8tjtxEozrGn4CLtFwl30W8RQDAfW1opwudz7ClskPaLhDv0X5vfPP+pJbPOomA5/P5ChbRfJNwV3GkAQXxqmboNwMvw+wsi7RcLdwX32nv/3lEAC1ODI+0Xge4K7jWt+r9VWlmBlU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ClVXTgks3BJn1LO5typzABwZneR1cnYBb1SOCc04NNkH/qS/oNz0+3+QDzstKba0NuGnD2wEag8ykd/UI49Wg38zx8wvvBOBgAV4P4BRWSppK+rH/PnNJi7osne1fOw/LVF19J6//vtmRf1F1lc4nLs8FeGWlWqcWn608qVqLyH2/Y+AYkY0AuixTdT2tiaoraf5w4hN+UTOEoKfH1Yu8AeiyXM14fqz2RfbGqgLbNZe0rrbzYxsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgD38H+TThaxYeMKlAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(draw)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`Path` contains a `Path_Fill_Type` which determines whether overlapping `Contours` form fills or holes. `Path_Fill_Type` also determines whether area inside or outside `Lines` and `Curves` is filled."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def draw(canvas: skia.Canvas):\n",
    "    paint = skia.Paint()\n",
    "    paint.setAntiAlias(True)\n",
    "    path = skia.Path()\n",
    "    path.moveTo(36, 48)\n",
    "    path.quadTo(66, 88, 120, 36)\n",
    "    canvas.drawPath(path, paint)\n",
    "    paint.setStyle(skia.Paint.kStroke_Style)\n",
    "    paint.setColor(skia.ColorBLUE)\n",
    "    paint.setStrokeWidth(8)\n",
    "    canvas.translate(0, 50)\n",
    "    canvas.drawPath(path, paint)\n",
    "    paint.setStyle(skia.Paint.kStrokeAndFill_Style)\n",
    "    paint.setColor(skia.ColorRED)\n",
    "    canvas.translate(0, 50)\n",
    "    canvas.drawPath(path, paint)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`Path` is drawn filled, then stroked, then stroked and filled."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
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Wr8E98IuxLgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(draw)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`Path` contents are never shared. Copying `Path` by value effectively creates a new `Path` independent of the original. Internally, the copy does not duplicate its contents until it is edited, to reduce memory use and improve performance."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "`Contour` contains one or more `Verbs`, and as many `Points` as are required to satisfy `Path_Verb_Array`. First `Path_Verb` in `Path` is always `PathVerb.kMove` each `PathVerb.kMove` that follows starts a new `Contour`.\n",
    "\n",
    "### Example"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def draw(canvas: skia.Canvas):\n",
    "    font = skia.Font()\n",
    "    paint = skia.Paint()\n",
    "    paint.setAntiAlias(True)\n",
    "    canvas.drawString(\"1st contour\", 150, 100, font, paint)\n",
    "    canvas.drawString(\"2nd contour\", 130, 160, font, paint)\n",
    "    canvas.drawString(\"3rd contour\", 40, 30, font, paint)\n",
    "    paint.setStyle(skia.Paint.kStroke_Style)\n",
    "    path = skia.Path()\n",
    "    path.moveTo(124, 108)\n",
    "    path.lineTo(172, 24)\n",
    "    path.moveTo(36, 148)\n",
    "    path.quadTo(66, 188, 120, 136)\n",
    "    path.close()\n",
    "    path.conicTo(70, 20, 110, 40, 0.6)\n",
    "    canvas.drawPath(path, paint)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Each `Path.moveTo` starts a new `Contour`, and content after `Path.close()` also starts a new `Contour`. Since `Path.conicTo` is not preceded by `Path.moveTo`, the first `Point` of the third `Contour` starts at the last `Point` of the second `Contour`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoA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/T4NqxxOo/gMmmxXag6FwpvsbzY2a1H6JqY93fY7VzgmFHcBKu2jpwqg5VPNIY3Ynol1B34BfN1zLJtiMnAl9oe4A/Ch12iKDQDuwy7COgI7mybeohDreqAfcBjFBfu5jP0Op7iieNi9LqS48Cbp32TwsdwxS43oYR9p6b/3DbTexWQbyfu04KXmYpOErsWeGRCSyVjf9Sr3cwb5KvxbAw9idxbuTnHhB/i4zDZrgJ1Sv2edUbtK1jsAa76vxM7UpduvqnDMUj3tY4vUZ+n1JGDDsbPNT3wHUoWk4D8OHOI1kspmYWfZMdhcDMlPH6w5nm5Kt2NN6P3dNocC22IXLZXrAiTrTcDu81gOnIqlHdcDE916cygM2mUdE2zKuG5gVA/7SAYyD3bxdVHoAiTdCQnYhdgfSbvvQMoIpeAn5mOFpfRnNNmFsQ0bTU/WXUz5CqANu305WW8JlgXohQ2CdmMFch02+k+FYyY6KYwDZO2jN4VKKckQrMUqC1UAkdgR+AM2Ep0HoRX8etgFGFLFeoOws3epoVhro9YxqfSksZX2MYTiroBE6FzsYRgTPBy7P3AUrVfwRXJleyxLsAG4EziBQhqp3g7FUlDPAf/Ebtc9pEHHEpEa9MUK/51YZfA4Nl6w+ybscx/gAmw+gv8CjwKXEl42QuT/8jYjUKNMxvLaR7jfFwDvY4NTbdi/Q/o1/X4Edk/+O9iA0kPu55PmhS/SGK1SAaTtjl1VtivwqfvpLnlNv1+LFfg3fQQrIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIqH4HxzLcYLl/mlzAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(draw)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If final `PathVerb` in `Contour` is `PathVerb.kClose`, `Line` connects `Path_Last_Point` in `Contour` with first `Point`. A closed `Contour`, stroked, draws `Paint_Stroke_Join` at `Path_Last_Point` and first `Point`. Without `PathVerb.kClose` as final `Verb`, `Path_Last_Point` and first `Point` are not connected; `Contour` remains open. An open `Contour`, stroked, draws `Paint_Stroke_Cap` at `Path_Last_Point` and first `Point`.\n",
    "\n",
    "### Example"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def draw(canvas: skia.Canvas):\n",
    "    paint = skia.Paint()\n",
    "    paint.setAntiAlias(True)\n",
    "    paint.setStyle(skia.Paint.kStroke_Style)\n",
    "    paint.setStrokeWidth(8)\n",
    "    path = skia.Path()\n",
    "    path.moveTo(36, 48)\n",
    "    path.quadTo(66, 88, 120, 36)\n",
    "    canvas.drawPath(path, paint)\n",
    "    path.close()\n",
    "    canvas.translate(0, 50)\n",
    "    canvas.drawPath(path, paint)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`Path` is drawn stroked, with an open `Contour` and a closed `Contour`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQAAAADACAYAAADr7b1mAAAABHNCSVQICAgIfAhkiAAABwtJREFUeJzt3V2oHOUdx/GvJuJ7ckzBV6IjeFEh4AaEolBcwXoRpRWvCr3IEfTKCysU7FUSKZTWlmqx9NJEUKxeGEVBhFKi0ou20iQW9cKXHKVRtGnPOWhoKtX14r+LJye758xMZubZ2fl+4GETOOz+d9nfM888z7MzIEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEkdcifwLHBm6kIkNese4CtgAOxNXIukBu0igr+y/SJpRZJqdwbwKKeGf9TuS1eapDptBJ5icvhHbT5RfZJqci7wMuuHfwB8CdyepkxJVbsY+Dv5wj8APgduTlKppEptA46SP/yLwPYklUqq1A7gOPnD/xHw7SSVSqrUA8S5fN7wvwNsTVKppMpsBJ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TmEHMFshn8Twa6yudAAZsx/yST4gzvkNv04xSx1AxuyHfBnYXODvDxOfw1It1aj12rYVOGP2Q36YCOyB4eMh4j6DfeJGJEWep4/h1xqmcQSQ0d2QL0z4+93AngLP/zwwj+HXOlJ1ABmGPI85YC9xDp/X40T4pak0R4Qh9V18q2iHiIDvIW4F3ic6tyr0iNuPFannkYpeW6pVjzgqpg5w6pBPMl+izvmaa5IqNU/6cKcM+TijIX+R2peYrVMndcg+uhfySXrAQYq/pyxBrVIlqp4PmPaQT7Kb4u/1OeLzk1qt6HxAW0M+Tpmj/gAn+zRj7iD/l38+TYmVK3PUX6LYkqDUGnvoRifQp9xR3/N9zbx95A9EkW2x0yCj+Ay/Q351StFJwf1M/0TYHOWG+w751UlFO4GDTO86+H3AIuXCfwCH/OqoMsuDDzMdo4HREb9s8JeI1Q2p08p0AkeAnSmK5Ztz/LLB96gvrVJ2o1BTHcHc8HX2l6jRo76UwxxxZCwTrCPEcDyruJ4qQj9q7uiTcniE0wvaQaIz+AHFOoQeEfi9lFu/X2u43y/yAUhVm8YrAq1lnghiFUYX6ZikrguUfEBsetpXw3NLM69HOy8oskSxy3pJWsMe2nFRkYVhrZ7nSxXLKD9BWHc7RLt/syC1Rp+YTU8d+sGwjn6db1bSeBnNXmVoZejncZgvTYU5IpB1jQqWMPSaAW1bBixjtJzXHz72iHsSFPEKcU4/uhrRQmXVSQl1oQOYpL/q/z0i2CvvpnOgoVokSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZKS+xrfmE4xVH0fxQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "show(draw)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "`Contour` length is distance traveled from first `Point` to `Path_Last_Point`, plus, if `Contour` is closed, distance from `Path_Last_Point` to first `Point`. Even if `Contour` length is zero, stroked `Lines` are drawn if `Paint_Stroke_Cap` makes them visible.\n",
    "\n",
    "### Example"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQAAAADACAYAAADr7b1mAAAABHNCSVQICAgIfAhkiAAAATpJREFUeJzt2MEJwkAQBdCvlW0J6djYgZ3EDuJBIV6SwGLcRN+DQGDhM5f5h0kAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgC10SS5JhiTj679UZo0rH7AjXeaXtVTkKQA4kD7zy9pX5CkAOJClZR0+nKcA4M259QArTq0HgF+2hwK4LrzdvjYF0IQjIPy5Ls+D3z3T8a9UZikAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANjQA0qJVdjqWRx8AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "def draw(canvas: skia.Canvas):\n",
    "    paint = skia.Paint()\n",
    "    paint.setAntiAlias(True)\n",
    "    paint.setStyle(skia.Paint.kStroke_Style)\n",
    "    paint.setStrokeWidth(8)\n",
    "    paint.setStrokeCap(skia.Paint.kRound_Cap)\n",
    "    path = skia.Path()\n",
    "    path.moveTo(36, 48)\n",
    "    path.lineTo(36, 48)\n",
    "    canvas.drawPath(path, paint)\n",
    "    path.reset()\n",
    "    paint.setStrokeCap(skia.Paint.kSquare_Cap)\n",
    "    path.moveTo(56, 48)\n",
    "    path.close()\n",
    "    canvas.drawPath(path, paint)\n",
    "    \n",
    "show(draw)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
